package com.schedule.common.enums;

/**
 * 时间段枚举
 */
public enum TimeSlot {
    SLOT_1(1, "08:30", "09:30", "上午"),
    SLOT_2(2, "09:30", "10:30", "上午"),
    SLOT_3(3, "10:30", "11:30", "上午"),
    SLOT_4(4, "11:30", "12:30", "上午"),
    SLOT_5(5, "13:30", "14:30", "下午"),
    SLOT_6(6, "14:30", "15:30", "下午"),
    SLOT_7(7, "15:30", "16:30", "下午"),
    SLOT_8(8, "16:30", "17:30", "下午");

    private final int slot;
    private final String startTime;
    private final String endTime;
    private final String period;

    TimeSlot(int slot, String startTime, String endTime, String period) {
        this.slot = slot;
        this.startTime = startTime;
        this.endTime = endTime;
        this.period = period;
    }

    public int getSlot() {
        return slot;
    }

    public String getStartTime() {
        return startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public String getPeriod() {
        return period;
    }

    public static TimeSlot getBySlot(int slot) {
        for (TimeSlot timeSlot : values()) {
            if (timeSlot.getSlot() == slot) {
                return timeSlot;
            }
        }
        return null;
    }
}